/**
*@author       wuwg
*@createTime   2018/03/20
*@updateTime   2018/05/04
*@description
*@rule
 */
@import '../../../config/config.less';
@import '../../../mixins/select-item/index.less';

@css-prefix-menu: ~"@{css-prefix}menu";
@css-prefix-select-dropdown: ~"@{css-prefix}select-dropdown";
@css-prefix-dropdown-transfer: ~"@{css-prefix-menu}-transfer";
@menu-dropdown-item-prefix-cls: ~"@{css-prefix-menu}-horizontal .@{css-prefix-menu}-submenu .@{css-prefix-select-dropdown} .@{css-prefix-menu}-item";
@menu-dropdown-item-prefix-cls-transfer: ~"@{css-prefix-dropdown-transfer} .@{css-prefix-menu}-item";

.@{css-prefix-menu} {
  display: block;
  margin: 0;
  padding: 0;
  outline: none;
  list-style: none;
  color: @text-color;
  font-size: @font-size-base;
  position: relative;
  z-index: @zindex-select;





  .@{css-prefix}img-icon {
    width: 20px;
    height: 20px;
  }

  // 水平
  &-horizontal{
    height: 60px;
    line-height: 60px;

    &.@{css-prefix-menu}-light{
      &:after{
        content: '';
        display: block;
        width: 100%;
        height: 1px;
        background: @border-color-base;
        position: absolute;
        bottom: 0;
        left: 0;
      }
    }
  }

  //  垂直
  &-vertical{
    &.@{css-prefix-menu}-light{
      &:after{
        content: '';
        display: block;
        width: 1px;
        height: 100%;
        background: @border-color-base;
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        z-index: 1;
      }
    }
  }

  &-light{
    background: #fff;
  }
  &-dark{
    background: @menu-dark-title;
  }
  &-primary{
    background: @primary-color;
  }

  &-item{
    display: block;
    outline: none;
    list-style: none;
    font-size: @font-size-base;
    position: relative;
    z-index: 1;
    cursor: pointer;
    transition: all @transition-time @ease-in-out;
  }
  &-item > i{
    margin-right: 6px;
  }
  &-submenu-title > i, &-submenu-title span > i{
    margin-right: 8px;
  }

  &-horizontal &-item,
  &-horizontal &-submenu
  {
    float: left;
    padding: 0 20px;
    position: relative;
    cursor: pointer;
    z-index: 3;
    transition: all @transition-time @ease-in-out;
  }

  &-light&-horizontal &-item, &-light&-horizontal &-submenu{
    height: inherit;
    line-height: inherit;
    border-bottom: 2px solid transparent;
    color: @text-color;
    &-active, &:hover{
      color: @primary-color;
      border-bottom: 2px solid @primary-color;
    }
  }

  &-dark&-horizontal &-item, &-dark&-horizontal &-submenu{
    color: @menu-dark-subsidiary-color;
    &-active, &:hover{
      color: #fff;
    }
  }

  &-primary&-horizontal &-item, &-primary&-horizontal &-submenu{
    color: #fff;
    &-active, &:hover{
      background: @link-active-color;
    }
  }

  &-horizontal &-submenu .@{css-prefix-select-dropdown} {
    min-width: 100%;
    width: auto;
    max-height: none;
    .@{css-prefix-menu}-item{
      height: auto;
      line-height: normal;
      border-bottom: 0;
      float: none;
    }
  }

  &-item-group{
    line-height: normal;
    &-title {
      height: 30px;
      line-height: 30px;
      padding-left: 8px;
      font-size: @font-size-small;
      color: @legend-color;
       i{
         margin-right: 6px;
       }
    }

    & > ul{
      padding: 0 !important;
      list-style: none !important;
    }
  }

  // vertical
  &-vertical &-item,
  &-vertical &-submenu-title
  {
    padding: 10px 24px;
    line-height: 24px;
    position: relative;
    cursor: pointer;
    z-index: 1;
    transition: all @transition-time @ease-in-out;

    &:hover{
      background: @background-color-select-hover;
    }
  }

  &-vertical &-submenu-title-icon{
    float: right;
    position: relative;
    top: 4px;
  }
  &-submenu-title-icon {
    transition: transform @transition-time @ease-in-out;
  }
  &-opened > * > &-submenu-title-icon{
    transform: rotate(180deg);
  }

  &-vertical &-submenu{
    &-nested{
      padding-left: 20px;
    }
    .@{css-prefix-menu}-item{
      padding-left: 43px;
    }
    // 取消css3动画
    &:not(.animate) .collapse-transition  {
      transition:none
    }
  }
  &-vertical &-item-group{
    &-title{
      height: 48px;
      line-height: 48px;
      font-size: @font-size-base;
      padding-left: 28px;
    }
  }
  &-dark&-vertical &-item-group{
    &-title{
      color: @menu-dark-group-title-color;
    }
  }

  &-light&-vertical &-item{
    border-right: 2px solid transparent;
    &-active:not(.@{css-prefix-menu}-submenu){
      color: @primary-color;
      border-right: 2px solid @primary-color;
      z-index: 2;
    }
  }

  &-dark&-vertical &-item, &-dark&-vertical &-submenu-title{
    color: @menu-dark-subsidiary-color;
    &-active:not(.@{css-prefix-menu}-submenu),
    &-active:not(.@{css-prefix-menu}-submenu):hover
    {
      background: @menu-dark-active-bg;
    }
    &:hover{
      color: #fff;
      background: @menu-dark-title;
    }
    &-active:not(.@{css-prefix-menu}-submenu){
      color: @primary-color;
      border-right: 2px solid @primary-color;
    }
  }
  &-dark&-vertical &-submenu &-item{
    &:hover{
      color: #fff;
      background: transparent !important;
    }
    &-active,&-active:hover{
      border-right: none;
      color: #fff;
      background: @primary-color !important;
    }
  }
  // &-dark&-vertical &-item-active &-submenu-title{
  //     color: #fff;
  // }
  &-dark&-vertical &-child-item-active > &-submenu-title{
    color: #fff;
  }

  &-dark&-vertical &-opened{
    background: @menu-dark-active-bg;
    .@{css-prefix-menu}-submenu-title{
      background: @menu-dark-title;
    }

    .@{css-prefix-menu}-submenu-has-parent-submenu{
      .@{css-prefix-menu}-submenu-title{
        background: transparent;
      }
    }
  }
}

/**
mode = horizontal
aty-select-dropdown
 */
.@{css-prefix-dropdown-transfer} {
  min-width: 100%;
  width: auto;
  max-height: none;
  .@{css-prefix-menu}-item{
    height: auto;
    line-height: normal;
    border-bottom: 0;
    float: none;
    z-index: 3;
    text-align: center;
  }
}

.select-item(@css-prefix-menu, @menu-dropdown-item-prefix-cls);
.select-item(@css-prefix-menu, @menu-dropdown-item-prefix-cls-transfer);

.@{menu-dropdown-item-prefix-cls-transfer}, .@{menu-dropdown-item-prefix-cls} {
  padding: 7px 16px 8px;
  font-size: @font-size-base !important;
}
